package file;

import java.io.File;
import java.io.IOException;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: YKH
 * Date: 2022-08-07
 * Time: 7:44
 */
public class Demo01 {
    public static void main(String[] args) throws IOException {
        //绝对路径
        //File file = new File("d:/test.txt");
        //相对路径
        File file = new File("./test.txt");
        System.out.println( file.getParent()); //获取父路径
        System.out.println( file.getName()); //获取文件名
        System.out.println(file.getPath());  //获取路径
        System.out.println( file.getAbsoluteFile());//获取到绝对路径
        System.out.println( file.getCanonicalPath());//获取规范的路径
    }
}
